{extend name="base" /}
{block name="content"}
<div class="g-main">
    <div class="m-main-title">
        <div class="m-container-fluid">
            <a href="{:url('index/welcome')}"><i class="icon icon-home"></i>首页</a>
            <span class="icon-angle-right"></span>
            <span>门店管理</span>
            <span class="icon-angle-right"></span>
            <span>店长管理</span>
            <span class="icon-angle-right"></span>
            <span>{$info ? '编辑' : '添加'}店长</span>
            <a class="u-flush"><i class="icon-repeat"></i></a>
        </div>
    </div>
    <div class="m-main-content">
        <div class="m-container">
            <div class="m-form">
                <form class="layui-form" id="j_form">
                    <table class="m-table">
                        <thead>
                        <tr>
                            <th colspan="2">{$info ? '编辑' : '添加'}店长</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td width="15%"><label for="username">用户名称<em>*</em></label></td>
                            <td>{if condition="$info"}{$info.username}{else/}<input type="text" class="u-ipt u-ipt-long" name="username" id="username" placeholder="请输入用户名称" value="{$info.username}" /><span>6 位以上，可以包含数字、大小写英文字母、下划线</span>{/if}</td>
                        </tr>
                        <tr>
                            <td><label for="password">密码{if condition="!$info"}<em>*</em>{/if}</label></td>
                            <td><input type="password" class="u-ipt u-ipt-long" name="password" id="password" placeholder="请输入密码" /><span>6 位以上，可以包含数字、大小写英文字母、下划线、@</span></td>
                        </tr>
                        <tr>
                            <td><label for="password_confirm">确认密码{if condition="!$info"}<em>*</em>{/if}</label></td>
                            <td><input type="password" class="u-ipt u-ipt-long" name="password_confirm" id="password_confirm" placeholder="请输入确认密码" /></td>
                        </tr>
                        <tr>
                            <td><label for="">请选择所属角色<em>*</em></label></td>
                            <td>
                                <div class="lay-select">
                                    <select name="role_id" lay-filter="role_id">
                                        {foreach name="roles" item="role"}
                                        {if condition="$role['id'] eq 2"}
                                        <option value="{$role.id}" >{$role.name}</option>
                                        {/if}
                                        {/foreach}
                                    </select>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td><label for="">请选择所属店铺<em>*</em></label></td>
                            <td>
                                <div class="lay-select">
                                    <select name="stores_id" lay-filter="stores_id">
                                        {foreach name="stores" item="v"}

                                        <option value="{$v.id}" {if condition="$v['id'] eq $info['stores_id']"} selected{/if} >{$v.name}</option>

                                        {/foreach}
                                    </select>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td><label for="">启用状态</label></td>
                            <td>
                                <input type="radio" name="status" value="1" title="启用"{if condition="!$info || $info['status'] eq 1"} checked{/if} />
                                <input type="radio" name="status" value="0" title="禁用"{if condition="$info && $info['status'] eq 0"} checked{/if} />
                            </td>
                        </tr>
                        <tr hidden>
                            <td><label for="">管理栏目</label></td>
                            <td>
                                <div class="m-select">
                                    <select name="admin_columns[]" id="admin_columns" multiple="multiple" size="12" style="width: 320px;" lay-ignore>

                                    </select>
                                </div>
                                <div class="m-label"><a class="u-cancel">[取消选择]</a>（选择父栏目后会自动选择子栏目）</div>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <input type="hidden" name="type" value="1">
                    <div class="m-form-btn"><input type="hidden" name="id" value="{$info.id}"><button id="j_btn" class="u-btn">确定提交</button></div>
                </form>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="extrajs"}
<script>
    $(function(){
        $('.u-cancel').click(function(){
            $('#admin_columns').val('');
        });
    })
</script>
{/block}